﻿<UserControl x:Class="CalculationDemo.MainPage"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
    xmlns:sdk="http://schemas.microsoft.com/winfx/2006/xaml/presentation/sdk"
    mc:Ignorable="d"
    d:DesignHeight="300" d:DesignWidth="400">
    
    <Grid x:Name="LayoutRoot" Background="White">
        <Grid.RowDefinitions>
            <RowDefinition Height="AUTO" />
            <RowDefinition Height="200" />
            <RowDefinition Height="AUTO" />
            <RowDefinition Height="260" />
            <RowDefinition Height="AUTO" />
            <RowDefinition Height="AUTO" />
        </Grid.RowDefinitions>
        <Grid.ColumnDefinitions>
            <ColumnDefinition Width="80"/>
            <ColumnDefinition Width="500"/>
            <ColumnDefinition Width="500"/>
            <ColumnDefinition Width="200"/>
        </Grid.ColumnDefinitions>

        <StackPanel Orientation="Horizontal" Margin="5,10,0,30"   Grid.Row="0" Grid.Column="0" Grid.ColumnSpan="3">
            <TextBlock Text="Input Date "  Width="90" Margin="2,10,0,2"/>
            <TextBox Name="CalculateDate"  Width="100" Margin="0,10,0,2"/>
        </StackPanel>

        <StackPanel Margin="5,10,0,0" Grid.Row="1"  Grid.Column="0" Grid.ColumnSpan="3">
            <TextBlock Text="Import Activities" Margin="2,2,2,5"/>

            <sdk:DataGrid x:Name="planGrid" AutoGenerateColumns="False" ItemsSource="{Binding PlanList}" Loaded="planGrid_Loaded">
                <sdk:DataGrid.Columns>
                    <sdk:DataGridTextColumn Header="Plan ID"       Binding="{Binding PlanID}"  />
                    <sdk:DataGridTextColumn Header="Unit Name"       Binding="{Binding UnitName}"  />
                    <sdk:DataGridTextColumn Header="Unit Type"    Binding="{Binding UnitType}"  />
                    <sdk:DataGridTextColumn Header="Fluid Type"    Binding="{Binding FluidType}"  />
                    <sdk:DataGridTextColumn Header="Start Date"    Binding="{Binding Start}"  />
                    <sdk:DataGridTextColumn Header="End Date"    Binding="{Binding End}"  />
                </sdk:DataGrid.Columns>
            </sdk:DataGrid>
        </StackPanel>

        <StackPanel Orientation="Vertical" Margin="5,10,0,0" Grid.Row="1"  Grid.Column="3">
            <Button Content="Calculate" Width="100" Margin="0,20,0,0" Click="Button_Click"></Button>
            <Button Content="Water Network" Width="100" Margin="0,20,0,0" Click="WaterNetworkButton_Click"></Button>
            <Button Content="Oil Network" Width="100" Margin="0,20,0,0" Click="OilNetworkButton_Click"></Button>
        </StackPanel>

        <Path Data="M25.666672,37 L204.34454,37" Margin="0,5,0,5" Stretch="Fill" StrokeThickness="1" UseLayoutRounding="False" 
              VerticalAlignment="Top" Height="1" Stroke="Black"
              Grid.Row="2"  Grid.ColumnSpan="3"/>

        <StackPanel  Orientation="Vertical" Margin="5,5,0,0" Grid.Row="3" Grid.Column="0">
            <TextBlock Text="Layer Name" Margin="2,2,2,5"/>

            <sdk:DataGrid x:Name="layerGrid" IsReadOnly="True" ItemsSource="{Binding LayerList}"
                           Loaded="layerGrid_Loaded" SelectionChanged="layerGrid_SelectionChanged">
            </sdk:DataGrid>
        </StackPanel>

        <StackPanel Orientation="Vertical" Margin="20,5,0,0" Grid.Row="3"  Grid.Column="1">
            <TextBlock Text="Production Strings" Margin="2,2,2,5"/>

            <sdk:DataGrid x:Name="pStringGrid" AutoGenerateColumns="False" ItemsSource="{Binding PList}" Loaded="pStringGrid_Loaded">
                <sdk:DataGrid.Columns>
                    <sdk:DataGridTextColumn Header="Unit Name"       Binding="{Binding unitName}"  />
                    <sdk:DataGridTextColumn Header="Percentage"    Binding="{Binding percentage}"  />
                    <sdk:DataGridTextColumn Header="Capacity"    Binding="{Binding capacity}"  />
                    <sdk:DataGridTextColumn Header="Real Capacity"    Binding="{Binding realCapacity}"  />
                    <sdk:DataGridTextColumn Header="Layer Real Capacity"    Binding="{Binding currentDayCapacity}"  />
                </sdk:DataGrid.Columns>
            </sdk:DataGrid>

            <StackPanel Orientation="Horizontal">
                <TextBlock Text="Current Day Production Sum Amount"  Margin="2,10,10,0"/>
                <TextBlock x:Name="pSumTextBlock"  Width="100" Margin="2,10,0,0"/>
            </StackPanel>
        </StackPanel>

        <StackPanel Orientation="Vertical" Margin="20,5,0,0" Grid.Row="3"  Grid.Column="2">
            <TextBlock Text="Injection Strings" Margin="2,2,2,5"/>

            <sdk:DataGrid x:Name="iStringGrid" AutoGenerateColumns="False" ItemsSource="{Binding IList}" Loaded="iStringGrid_Loaded">
                <sdk:DataGrid.Columns>
                    <sdk:DataGridTextColumn Header="Unit Name"       Binding="{Binding unitName}"  />
                    <sdk:DataGridTextColumn Header="Percentage"    Binding="{Binding percentage}"  />
                    <sdk:DataGridTextColumn Header="Capacity"    Binding="{Binding capacity}"  />
                    <sdk:DataGridTextColumn Header="Real Capacity"    Binding="{Binding realCapacity}"  />
                    <sdk:DataGridTextColumn Header="Layer Real Capacity"    Binding="{Binding currentDayCapacity}"  />
                </sdk:DataGrid.Columns>
            </sdk:DataGrid>
            
            <StackPanel Orientation="Horizontal">
                <TextBlock Text="Current Day Injection Sum Amount"  Margin="0,10,10,0"/>
                <TextBlock x:Name="iSumTextBlock"  Width="100" Margin="0,10,0,0"/>
            </StackPanel>
        </StackPanel>

        <Path Data="M25.666672,37 L204.34454,37" Margin="0,5,0,5" Stretch="Fill" StrokeThickness="1" UseLayoutRounding="False" 
              VerticalAlignment="Top" Height="1" Stroke="Black"
              Grid.Row="4"  Grid.ColumnSpan="3"/>

        <StackPanel Orientation="Horizontal" Margin="5,10,0,0" Grid.Row="5"  Grid.Column="0" Grid.ColumnSpan="2">
            <TextBlock Text="Effective Capacity" Margin="2,10,0,0"/>
            <TextBlock Name="ECresult"  Margin="5,10,0,0"/>
        </StackPanel>
                      
    </Grid>
</UserControl>
